package top.psjj.mall.comment;

import com.google.common.collect.Sets;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Repository;

import java.util.Set;

/**
 * 全局常量
 */
@Repository
public class Constant {
    public static String UPLOAD_DIRECTORY;

    @Value("${upload_dir}")
    public void setUploadDirectory(String uploadDirectory) {
        UPLOAD_DIRECTORY = uploadDirectory;
    }

    //系统常量
    public interface System{
        public static final String SALT = "abc98@.,72.,";

    }
    //用户常量
    public interface User{
        public static final String CURRENT_USER = "currentUser";
        public static final Integer IS_USER = 1;
        public static final Integer IS_ADMIN = 2;
    }

    //商品排序
    public interface ProductListOrderBy{
        Set<String> PRICE_ASC_DESC = Sets.newHashSet("price desc","price asc");
    }

    //售卖状态
    public interface SellStatus{
        int NOT_SELL=0;
        int SELL=1;
    }
    public interface CartSelected{
        int NOT_SELECT=0;
        int SELECTED=1;
    }

    //
    public enum OrderStatusEnum{
        CANCELED(0,"用户已取消"),
        NOT_PAID(10,"未付款"),
        PAID(20,"已付款"),
        DELIVERED(30,"已发货"),
        FINISHED(40,"交易完成");
        private int code;
        private String value;

        public int getCode() {
            return code;
        }

        public void setCode(int code) {
            this.code = code;
        }

        public String getValue() {
            return value;
        }

        public void setValue(String value) {
            this.value = value;
        }

        OrderStatusEnum(int code, String value){
            this.code = code;
            this.value = value;
        }

    }
}
